package
{
	import com.liseen.utils.FPS;
	
	import flash.display.Sprite;
	import flash.events.Event;
	import flash.system.Capabilities;
	
	public class Main extends Sprite implements IStartInterFace
	{
		private var _myGame:Game;
		public function Main()
		{
			if(stage)
			{
				init(null);
			}else{
				this.addEventListener(Event.ADDED_TO_STAGE,init);
			}
		}
		
		private function init(event:Event=null):void
		{
			this.removeEventListener(Event.ADDED_TO_STAGE,init);
			
			GlobalContext.getInstance(this);
			
		}
		
		public function run(parameters:Object):void
		{
			
			if(!parameters){
				throw new Error("Invalid Load Processing!");
			}
			
			parameters.serverURL = "http://122.71.125.232/ninja/gateway.php";
			parameters.userID = "6553065";
			parameters.hashCode = "xxxoooo";
			parameters.registerTime = "120712";
			//设置flashVars
			GlobalContext.setFlashVars(parameters);
			
			
			_myGame = new Game();
			
			if(Capabilities.isDebugger){
				this.addChild(new FPS());
			}
		}
		
	}
}